@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 0 0% 3.9%;
    --card: 0 0% 100%;
    --card-foreground: 0 0% 3.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 0 0% 3.9%;
    --primary: 0 0% 9%;
    --primary-foreground: 0 0% 98%;
    --secondary: 0 0% 96.1%;
    --secondary-foreground: 0 0% 9%;
    --muted: 0 0% 96.1%;
    --muted-foreground: 0 0% 45.1%;
    --accent: 0 0% 96.1%;
    --accent-foreground: 0 0% 9%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 0 0% 98%;
    --border: 0 0% 89.8%;
    --input: 0 0% 89.8%;
    --ring: 0 0% 3.9%;
    --radius: 0.5rem;
    --chart-1: 199 89% 48%;
    --chart-2: 209 75% 64%;
    --chart-3: 197 37% 24%;
    --chart-4: 43 74% 66%;
    --chart-5: 27 87% 67%;
    --sidebar-background: 0 0% 98%;
    --sidebar-foreground: 240 5.3% 26.1%;
    --sidebar-primary: 240 5.9% 10%;
    --sidebar-primary-foreground: 0 0% 98%;
    --sidebar-accent: 240 4.8% 95.9%;
    --sidebar-accent-foreground: 240 5.9% 10%;
    --sidebar-border: 220 13% 91%;
    --sidebar-ring: 217.2 91.2% 59.8%;
    --elegant-font: "Great Vibes";
    --color-1: oklch(66.2% 0.225 25.9);
    --color-2: oklch(60.4% 0.26 302);
    --color-3: oklch(69.6% 0.165 251);
    --color-4: oklch(80.2% 0.134 225);
    --color-5: oklch(90.7% 0.231 133);
  }

  .dark {
    --background: 0 0% 3.9%;
    --foreground: 0 0% 98%;
    --card: 0 0% 3.9%;
    --card-foreground: 0 0% 98%;
    --popover: 0 0% 3.9%;
    --popover-foreground: 0 0% 98%;
    --primary: 0 0% 98%;
    --primary-foreground: 0 0% 9%;
    --secondary: 0 0% 14.9%;
    --secondary-foreground: 0 0% 98%;
    --muted: 0 0% 14.9%;
    --muted-foreground: 0 0% 63.9%;
    --accent: 0 0% 14.9%;
    --accent-foreground: 0 0% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 0 0% 98%;
    --border: 0 0% 14.9%;
    --input: 0 0% 14.9%;
    --ring: 0 0% 83.1%;
    --chart-1: 186 86% 53%;
    --chart-2: 199 89% 48%;
    --chart-3: 30 80% 55%;
    --chart-4: 280 65% 60%;
    --chart-5: 340 75% 55%;
    --sidebar-background: 240 5.9% 10%;
    --sidebar-foreground: 240 4.8% 95.9%;
    --sidebar-primary: 224.3 76.3% 48%;
    --sidebar-primary-foreground: 0 0% 100%;
    --sidebar-accent: 240 3.7% 15.9%;
    --sidebar-accent-foreground: 240 4.8% 95.9%;
    --sidebar-border: 240 3.7% 15.9%;
    --sidebar-ring: 217.2 91.2% 59.8%;
    --color-1: oklch(66.2% 0.225 25.9);
    --color-2: oklch(60.4% 0.26 302);
    --color-3: oklch(69.6% 0.165 251);
    --color-4: oklch(80.2% 0.134 225);
    --color-5: oklch(90.7% 0.231 133);
  }
  .theme {
    --animate-rainbow: rainbow var(--speed, 2s) infinite linear;
    --animate-shiny-text: shiny-text 8s infinite;
  }
}

@layer base {
  * {
    @apply border-border;
  }
  html {
    @apply scroll-smooth;
  }
  body {
    @apply bg-background text-foreground overscroll-none;
    /* font-feature-settings: "rlig" 1, "calt" 1; */
    font-synthesis-weight: none;
    text-rendering: optimizeLegibility;
  }

  @supports (font: -apple-system-body) and (-webkit-appearance: none) {
    [data-wrapper] {
      @apply min-[1800px]:border-t;
    }
  }

  /* Custom scrollbar styling. Thanks @pranathiperii. */
  ::-webkit-scrollbar {
    width: 5px;
  }
  ::-webkit-scrollbar-track {
    background: transparent;
  }
  ::-webkit-scrollbar-thumb {
    background: hsl(var(--border));
    border-radius: 5px;
  }
  * {
    scrollbar-width: thin;
    scrollbar-color: hsl(var(--border)) transparent;
  }
}

@layer utilities {
  .step {
    counter-increment: step;
  }

  .step:before {
    @apply md:absolute w-8 h-8 md:w-9 md:h-9 bg-muted rounded-full font-mono font-medium text-center text-base inline-flex items-center justify-center -indent-px border-4 mr-2 border-background;
    @apply md:ml-[-50px] md:mt-[-4px];
    content: counter(step);
  }

  .chunk-container {
    @apply shadow-none;
  }

  .chunk-container::after {
    content: "";
    @apply absolute -inset-4 shadow-xl rounded-xl border;
  }

  /* Hide scrollbar for Chrome, Safari and Opera */
  .no-scrollbar::-webkit-scrollbar {
    display: none;
  }
  /* Hide scrollbar for IE, Edge and Firefox */
  .no-scrollbar {
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
  }

  .border-grid {
    @apply border-border/50 dark:border-border border-dashed;
  }

  .container-wrapper {
    @apply max-w-[1400px] min-[1800px]:max-w-screen-2xl min-[1400px]:border-x border-border/70 dark:border-border mx-auto w-full border-dashed;
  }

  .container {
    @apply px-4 xl:px-6 mx-auto max-w-screen-2xl;
  }
}

@layer base {
  * {
    @apply border-border;
  }
  body {
    @apply bg-background text-foreground;
  }
}

.prose {
  margin: 0 !important;
}

pre {
  padding: 12px !important;
  width: inherit !important;
  overflow-x: auto;
}

pre > code {
  display: grid;
  max-width: inherit !important;
  padding: 18px 0;
  font-size: 14px;
  font-family: "Geist Mono", monospace;
}

.code-line {
  padding: 0.75px 12.5px;
}

.line-number::before {
  display: inline-block;
  width: 1rem;
  margin-right: 22px;
  margin-left: -2px;
  color: rgb(110, 110, 110);
  content: attr(line);
  font-size: 13.5px;
  text-align: right;
}

.highlight-line {
  @apply dark:bg-neutral-800/90;
  @apply bg-neutral-200/90;
}

.punctuation {
  color: gray;
}

.comment {
  color: gray;
}

.keyword {
  color: rgb(255, 50, 115);
}

.function {
  color: hsla(210, 100%, 66%, 1);
}

.string,
.constant,
.annotation,
.boolean,
.number {
  color: hsl(0, 0%, 29%);
}

.dark .string,
.dark .constant,
.dark .annotation,
.dark .boolean,
.dark.number {
  color: hsl(0, 0%, 71%);
}

.dark .keyword {
  color: hsla(341, 90%, 67%, 1);
}

.attr-value {
  color: hsla(131, 43%, 57%, 1);
}

.tag {
  color: hsla(341, 90%, 67%, 1);
}

.attr-name {
  color: #414141;
}

.dark .attr-name {
  color: #cacaca;
}

.rehype-code-title {
  @apply px-2;
  @apply -mb-8;
  @apply w-full;
  @apply text-sm;
  @apply pt-1;
  @apply pb-5;
  @apply font-normal;
  @apply tracking-wider;
  @apply font-medium;
  font-family: var(--font-code) !important;
}

.highlight-comp > code {
  background-color: transparent !important;
}

.shiki-container {
  margin: 0;
  /* padding: 1rem; */
  /* padding-left: 1.5rem; Add more left padding */
}

.shiki-container pre {
  margin: 0;
  padding: 0;
}

.shiki {
  border-radius: 0.375rem;
  overflow: auto;
  font-family: "Geist Mono", monospace;

  line-height: 1.6; /* Improved line height for readability */
}

/* Add a subtle line number effect */
.shiki-container code {
  counter-reset: line;
  display: grid;
}

.shiki-container code > .line {
  padding-left: 0.75rem;
  position: relative;
}

.shiki-container code > .line:before {
  counter-increment: line;
  content: counter(line);
  position: absolute;
  left: -2.5rem;
  color: #64748b;
  opacity: 0.5;
  text-align: right;
  width: 1.5rem;
}

@theme inline {
  @keyframes rainbow {
    0% {
      background-position: 0%;
    }
    100% {
      background-position: 200%;
    }
  }
  @keyframes shiny-text {
    0%,
    90%,
    100% {
      background-position: calc(-100% - var(--shiny-width)) 0;
    }
    30%,
    60% {
      background-position: calc(100% + var(--shiny-width)) 0;
    }
  }
}
